#include "qsliderhost.h"



#include "qcommonstruct.h"
#include "qabstractproperty.h"
#include "qpropertyfactory.h"

#include <QSlider>
#include <QVariant>

using namespace SHAREDLIB;

QSliderHost::QSliderHost(QObject *object):
    QAbstractSliderHost(object)
{
    QAbstractProperty *pro;

    pro=QPropertyFactory::createProperty("Enum");
    if(pro!=NULL)
    {
        pro->setAttribute("name","tickPosition");
        pro->setAttribute("property_name",tr("TickPosition"));
        pro->setAttribute("group","Attributes");
        ComboItems items;
        tagComboItem item;
        item.m_text="NoTicks";
        item.m_value=QSlider::NoTicks;
        items.append(item);

        item.m_text="TicksAbove";
        item.m_value=QSlider::TicksAbove;
        items.append(item);

        item.m_text="TicksBelow";
        item.m_value=QSlider::TicksBelow;
        items.append(item);

        item.m_text="TicksLeft";
        item.m_value=QSlider::TicksLeft;
        items.append(item);

        item.m_text="TicksRight";
        item.m_value=QSlider::TicksRight;
        items.append(item);

        item.m_text="TicksBothSides";
        item.m_value=QSlider::TicksBothSides;
        items.append(item);

        QVariant v;
        v.setValue<ComboItems>(items);
        pro->setAttribute("items",v);
        addProperty(pro);
    }
}

void QSliderHost::setTickPosition(int tickPosition)
{
    setPropertyValue("tickPosition",tickPosition);
}

int QSliderHost::tickPosition()
{
    return getPropertyValue("tickPosition").toInt();
}
